package com.shanghaionstar.smart.adapter;


import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

import com.shanghaionstar.user.adapter.CommonAdapter;
import com.shanghaionstar.user.adapter.ViewHolder;

import java.util.HashSet;
import java.util.List;

/**
 * Created by Rengui Lu on 2016/6/29.
 */
public abstract class SmartGeoAdapter<T> extends CommonAdapter<T> {
    private HashSet<Integer> mSet = new HashSet<>();

    public void checkClick(int pos){
        if(mSet.contains(pos)){
            mSet.remove(pos);
        }else{
            mSet.add(pos);
        }
    }

    public HashSet<Integer> getmSet() {
        return mSet;
    }
    //    private int clickPosition = -1;
//
//    public int getClickPosition() {
//        return clickPosition;
//    }
//
//    public void setClickPosition(int clickPosition) {
//        this.clickPosition = clickPosition;
//    }

    public SmartGeoAdapter(Context context, List<T> datas, int layoutId) {
        super(context, datas, layoutId);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = ViewHolder.get(mContext, convertView, parent,
                layoutId, position);
        convert(holder, getItem(position), position);
        return holder.getConvertView();
    }


    @Override
    public void convert(ViewHolder holder, T t) {

    }

    public abstract void convert(ViewHolder holder, T t, int pos);
}
